package org.eggermont.hm.cluster;

import org.eggermont.hm.util.BoundingBox;

public class DefaultCondition implements AdmissibilityCondition {

    public Admissibility getAdmissiblilty(Cluster s, Cluster t) {
        if (isAdmissible(s, t)) {
            return Admissibility.NORMAL_ADMISSIBLE;
        } else {
            return Admissibility.INADMISSIBLE;
        }
    }

    public boolean isAdmissible(Cluster s, Cluster t) {
        final BoundingBox sB = s.getBoundingBox();
        final BoundingBox tB = t.getBoundingBox();
        double sizeS = sB.getDiameter();
        double sizeT = tB.getDiameter();
        return Math.min(sizeS, sizeT) < sB.distance(tB);
    }

}
